using RxjhServer.DbClss;
using System;
using System.Collections.Generic;
using System.Data;
using System.Timers;

namespace RxjhServer
{
	public class 骰子系统 : IDisposable
	{
		private DateTime dateTime_0;

		private static List<int> list_0;

		private string[] string_0;

		private System.Timers.Timer timer_0;

		private System.Timers.Timer timer_1;

		private System.Timers.Timer timer_2;

		static 骰子系统()
		{
			Class3.iAc72blzEsO7L();
			Class11.sYuN9pmzFowJx();
			smethod_0();
		}

		public 骰子系统()
		{
			Class3.iAc72blzEsO7L();
			Class11.sYuN9pmzFowJx();
			string_0 = World.骰子配置.Split(';');
			list_0.Clear();
			dateTime_0 = DateTime.Now.AddMinutes(World.骰子开奖倒计时间1);
			timer_0 = new System.Timers.Timer(World.骰子公告间隔时间);
			timer_0.Elapsed += 发送骰子开始时间公告;
			timer_0.Enabled = true;
			timer_0.AutoReset = true;
			发送骰子开始时间公告(null, null);
			timer_1 = new System.Timers.Timer(World.骰子开奖倒计时间2);
			timer_1.Elapsed += 骰子开始;
			timer_1.Enabled = true;
		}

		public void Dispose()
		{
			list_0.Clear();
			if (timer_0 != null)
			{
				timer_0.Enabled = false;
				timer_0.Close();
				timer_0.Dispose();
			}
			if (timer_1 != null)
			{
				timer_1.Enabled = false;
				timer_1.Close();
				timer_1.Dispose();
			}
			if (timer_2 != null)
			{
				timer_2.Enabled = false;
				timer_2.Close();
				timer_2.Dispose();
			}
			World.骰子 = null;
		}

		private static void smethod_0()
		{
			list_0 = new List<int>();
		}

		public void 发送骰子开始时间公告(object sender, ElapsedEventArgs e)
		{
			try
			{
				int num = (int)dateTime_0.Subtract(DateTime.Now).TotalSeconds;
				if (num != 0)
				{
					foreach (Players value in World.allConnectedChars.Values)
					{
						value.发送势力战开始倒计时(num);
						value.系统提示("买大赔大，买小赔小，买定离手！最后 " + num.ToString() + " 秒下注。", 10, World.骰子提示设置);
					}
				}
			}
			catch (Exception ex)
			{
				Form1.WriteLine(1, "骰子 时间结束事件1 出错：" + ex?.ToString());
			}
		}

		public void 骰子结束(object sender, ElapsedEventArgs e)
		{
			timer_2.Enabled = false;
			timer_2.Close();
			timer_2.Dispose();
			if (World.是否开启赌博类型 == 0)
			{
				try
				{
					World.骰子提示设置.Split(';');
					Random random = new Random();
					int num = 0;
					int num2 = 0;
					DataTable dBToDataTable = DBA.GetDBToDataTable("SELECT 购买大小,sum(大小赌注) AS 大小赌注 From TBL_人物数据 group by 购买大小", "GameServer");
					for (int i = 0; i < dBToDataTable.Rows.Count; i++)
					{
						if (dBToDataTable.Rows[i]["购买大小"].ToString().Equals("大"))
						{
							num = int.Parse(dBToDataTable.Rows[i]["大小赌注"].ToString());
						}
						else if (dBToDataTable.Rows[i]["购买大小"].ToString().Equals("小"))
						{
							num2 = int.Parse(dBToDataTable.Rows[i]["大小赌注"].ToString());
						}
					}
					if (num + num2 >= World.作假下注额)
					{
						if (num > num2)
						{
							int num3 = random.Next(1, 3);
							int num4 = random.Next(1, 4);
							int num5 = random.Next(1, 5);
							int num6 = num3 + num4 + num5;
							string text = (Convert.ToInt32(num3) == Convert.ToInt32(num4) && Convert.ToInt32(num3) == Convert.ToInt32(num5)) ? "豹子" : ((num6 < 10 || (Convert.ToInt32(num3) == Convert.ToInt32(num4) && Convert.ToInt32(num3) == Convert.ToInt32(num5))) ? "小" : "大");
							foreach (Players value in World.allConnectedChars.Values)
							{
								if (value.大小赌注 != 0)
								{
									value.系统提示("第一个骰子开出：" + num3.ToString(), 20, World.骰子提示设置);
									value.系统提示("第二个骰子开出：" + num4.ToString(), 20, World.骰子提示设置);
									value.系统提示("第三个骰子开出：" + num5.ToString(), 20, World.骰子提示设置);
									if (text != "豹子")
									{
										value.系统提示(num3.ToString() + "." + num4.ToString() + "." + num5.ToString() + " ，" + (num3 + num4 + num5).ToString() + "点。" + text, 22, World.骰子提示设置);
									}
									else
									{
										value.系统提示(num3.ToString() + "." + num4.ToString() + "." + num5.ToString() + " ，" + num3.ToString() + text, 22, World.骰子提示设置);
									}
									if (World.骰子功能是否开启 == 1)
									{
										if (text != "豹子" && value.购买大小 == text)
										{
											value.FLD_RXPIONT += (int)((double)value.大小赌注 * World.骰子大小奖励倍数);
											value.保存人物的数据();
											value.保存元宝数据();
											value.系统提示("买" + text + "赔大,赔您：" + ((double)value.大小赌注 * World.骰子大小奖励倍数).ToString() + "个元宝！", 10, World.骰子提示设置);
										}
										else if (text != "豹子" && value.购买大小 == num6.ToString())
										{
											value.FLD_RXPIONT += (int)((double)value.大小赌注 * World.骰子大小奖励倍数);
											value.保存人物的数据();
											value.保存元宝数据();
											value.系统提示("哎哟。买中 " + num6.ToString() + " 点，赔您：" + ((double)value.大小赌注 * World.骰子点数奖励倍数).ToString() + "个元宝！", 10, World.骰子提示设置);
										}
										else if (text == "豹子" && value.购买大小 == "豹子")
										{
											value.FLD_RXPIONT += (int)((double)value.大小赌注 * World.骰子豹子奖励倍数);
											value.保存人物的数据();
											value.保存元宝数据();
											value.系统提示("哇，3个" + num3.ToString() + "豹子耶，这也让你买中了，赔你" + ((double)value.大小赌注 * World.骰子豹子奖励倍数).ToString() + "个元宝！", 10, World.骰子提示设置);
										}
										else
										{
											value.保存人物的数据();
											value.保存元宝数据();
											value.系统提示("杀了您：" + value.大小赌注.ToString() + "个元宝！", 10, World.骰子提示设置);
										}
									}
									value.大小赌注 = 0;
									value.购买大小 = "0";
									value.大小次数 = 0;
									value.保存人物数据存储过程();
								}
							}
						}
						else
						{
							int num7 = random.Next(2, 7);
							int num8 = random.Next(2, 7);
							int num9 = random.Next(3, 7);
							int num10 = num7 + num8 + num9;
							string text2 = (Convert.ToInt32(num7) == Convert.ToInt32(num8) && Convert.ToInt32(num7) == Convert.ToInt32(num9)) ? "豹子" : ((num10 < 10 || (Convert.ToInt32(num7) == Convert.ToInt32(num8) && Convert.ToInt32(num7) == Convert.ToInt32(num9))) ? "小" : "大");
							foreach (Players value2 in World.allConnectedChars.Values)
							{
								if (value2.大小赌注 != 0)
								{
									value2.系统提示("第一个骰子开出：" + num7.ToString(), 20, World.骰子提示设置);
									value2.系统提示("第二个骰子开出：" + num8.ToString(), 20, World.骰子提示设置);
									value2.系统提示("第三个骰子开出：" + num9.ToString(), 20, World.骰子提示设置);
									if (text2 != "豹子")
									{
										value2.系统提示(num7.ToString() + "." + num8.ToString() + "." + num9.ToString() + " ，" + (num7 + num8 + num9).ToString() + "点。" + text2, 22, World.骰子提示设置);
									}
									else
									{
										value2.系统提示(num7.ToString() + "." + num8.ToString() + "." + num9.ToString() + " ，" + num7.ToString() + text2, 22, World.骰子提示设置);
									}
									if (World.骰子功能是否开启 == 1)
									{
										if (text2 != "豹子" && value2.购买大小 == text2)
										{
											value2.FLD_RXPIONT += (int)((double)value2.大小赌注 * World.骰子大小奖励倍数);
											value2.保存人物的数据();
											value2.保存元宝数据();
											value2.系统提示("买" + text2 + "赔大,赔您：" + ((double)value2.大小赌注 * World.骰子大小奖励倍数).ToString() + "个元宝！", 10, World.骰子提示设置);
										}
										else if (text2 != "豹子" && value2.购买大小 == num10.ToString())
										{
											value2.FLD_RXPIONT += (int)((double)value2.大小赌注 * World.骰子大小奖励倍数);
											value2.保存人物的数据();
											value2.保存元宝数据();
											value2.系统提示("哎哟。买中 " + num10.ToString() + " 点，赔您：" + ((double)value2.大小赌注 * World.骰子点数奖励倍数).ToString() + "个元宝！", 10, World.骰子提示设置);
										}
										else if (text2 == "豹子" && value2.购买大小 == "豹子")
										{
											value2.FLD_RXPIONT += (int)((double)value2.大小赌注 * World.骰子豹子奖励倍数);
											value2.保存人物的数据();
											value2.保存元宝数据();
											value2.系统提示("哇，3个" + num7.ToString() + "豹子耶，这也让你买中了，赔你" + ((double)value2.大小赌注 * World.骰子豹子奖励倍数).ToString() + "个元宝！", 10, World.骰子提示设置);
										}
										else
										{
											value2.保存人物的数据();
											value2.保存元宝数据();
											value2.系统提示("杀了您：" + value2.大小赌注.ToString() + "个元宝！", 10, World.骰子提示设置);
										}
									}
									value2.大小赌注 = 0;
									value2.购买大小 = "0";
									value2.大小次数 = 0;
									value2.保存人物数据存储过程();
								}
							}
						}
					}
					else
					{
						int num11 = random.Next(1, 7);
						int num12 = random.Next(1, 7);
						int num13 = random.Next(1, 7);
						int num14 = num11 + num12 + num13;
						string text3 = (Convert.ToInt32(num11) == Convert.ToInt32(num12) && Convert.ToInt32(num11) == Convert.ToInt32(num13)) ? "豹子" : ((num14 < 10 || (Convert.ToInt32(num11) == Convert.ToInt32(num12) && Convert.ToInt32(num11) == Convert.ToInt32(num13))) ? "小" : "大");
						foreach (Players value3 in World.allConnectedChars.Values)
						{
							if (value3.大小赌注 != 0)
							{
								value3.系统提示("第一个骰子开出：" + num11.ToString(), 20, World.骰子提示设置);
								value3.系统提示("第二个骰子开出：" + num12.ToString(), 20, World.骰子提示设置);
								value3.系统提示("第三个骰子开出：" + num13.ToString(), 20, World.骰子提示设置);
								if (text3 != "豹子")
								{
									value3.系统提示(num11.ToString() + "." + num12.ToString() + "." + num13.ToString() + " ，" + (num11 + num12 + num13).ToString() + "点。" + text3, 22, World.骰子提示设置);
								}
								else
								{
									value3.系统提示(num11.ToString() + "." + num12.ToString() + "." + num13.ToString() + " ，" + num11.ToString() + text3, 22, World.骰子提示设置);
								}
								if (World.骰子功能是否开启 == 1)
								{
									if (text3 != "豹子" && value3.购买大小 == text3)
									{
										value3.FLD_RXPIONT += (int)((double)value3.大小赌注 * World.骰子大小奖励倍数);
										value3.保存人物的数据();
										value3.保存元宝数据();
										value3.系统提示("买" + text3 + "赔大,赔您：" + ((double)value3.大小赌注 * World.骰子大小奖励倍数).ToString() + "个元宝！", 10, World.骰子提示设置);
									}
									else if (text3 != "豹子" && value3.购买大小 == num14.ToString())
									{
										value3.FLD_RXPIONT += (int)((double)value3.大小赌注 * World.骰子大小奖励倍数);
										value3.保存人物的数据();
										value3.保存元宝数据();
										value3.系统提示("哎哟。买中 " + num14.ToString() + " 点，赔您：" + ((double)value3.大小赌注 * World.骰子点数奖励倍数).ToString() + "个元宝！", 10, World.骰子提示设置);
									}
									else if (text3 == "豹子" && value3.购买大小 == "豹子")
									{
										value3.FLD_RXPIONT += (int)((double)value3.大小赌注 * World.骰子豹子奖励倍数);
										value3.保存人物的数据();
										value3.保存元宝数据();
										value3.系统提示("哇，3个" + num11.ToString() + "豹子耶，这也让你买中了，赔你" + ((double)value3.大小赌注 * World.骰子豹子奖励倍数).ToString() + "个元宝！", 10, World.骰子提示设置);
									}
									else
									{
										value3.保存人物的数据();
										value3.保存元宝数据();
										value3.系统提示("杀了您：" + value3.大小赌注.ToString() + "个元宝！", 10, World.骰子提示设置);
									}
								}
								value3.大小赌注 = 0;
								value3.购买大小 = "0";
								value3.大小次数 = 0;
								value3.保存人物数据存储过程();
							}
						}
					}
					DBA.ExeSqlCommand("update TBL_人物数据 set 购买大小='0',大小赌注=0,大小次数=0 where (ID>=0)", "GameServer");
					World.骰子.Dispose();
				}
				catch (Exception)
				{
				}
			}
			if (World.是否开启赌博类型 == 1)
			{
				try
				{
					World.骰子提示设置.Split(';');
					Random random2 = new Random();
					int num15 = 0;
					int num16 = 0;
					DataTable dBToDataTable2 = DBA.GetDBToDataTable("SELECT 购买大小,sum(积分赌注) AS 积分赌注 From TBL_人物数据 group by 购买大小", "GameServer");
					for (int j = 0; j < dBToDataTable2.Rows.Count; j++)
					{
						if (dBToDataTable2.Rows[j]["购买大小"].ToString().Equals("大"))
						{
							num15 = int.Parse(dBToDataTable2.Rows[j]["积分赌注"].ToString());
						}
						else if (dBToDataTable2.Rows[j]["购买大小"].ToString().Equals("小"))
						{
							num16 = int.Parse(dBToDataTable2.Rows[j]["积分赌注"].ToString());
						}
					}
					if (num15 + num16 >= World.作假下注额)
					{
						if (num15 > num16)
						{
							int num17 = random2.Next(1, 3);
							int num18 = random2.Next(1, 4);
							int num19 = random2.Next(1, 5);
							int num20 = num17 + num18 + num19;
							string text4 = (Convert.ToInt32(num17) == Convert.ToInt32(num18) && Convert.ToInt32(num17) == Convert.ToInt32(num19)) ? "豹子" : ((num20 < 10 || (Convert.ToInt32(num17) == Convert.ToInt32(num18) && Convert.ToInt32(num17) == Convert.ToInt32(num19))) ? "小" : "大");
							foreach (Players value4 in World.allConnectedChars.Values)
							{
								if (value4.积分赌注 != 0)
								{
									value4.系统提示("第一个骰子开出：" + num17.ToString(), 20, World.骰子提示设置);
									value4.系统提示("第二个骰子开出：" + num18.ToString(), 20, World.骰子提示设置);
									value4.系统提示("第三个骰子开出：" + num19.ToString(), 20, World.骰子提示设置);
									if (text4 != "豹子")
									{
										value4.系统提示(num17.ToString() + "." + num18.ToString() + "." + num19.ToString() + " ，" + (num17 + num18 + num19).ToString() + "点。" + text4, 22, World.骰子提示设置);
									}
									else
									{
										value4.系统提示(num17.ToString() + "." + num18.ToString() + "." + num19.ToString() + " ，" + num17.ToString() + text4, 22, World.骰子提示设置);
									}
									if (World.骰子功能是否开启 == 1)
									{
										if (text4 != "豹子" && value4.购买大小 == text4)
										{
											value4.FLD_RXPIONTX += (int)((double)value4.积分赌注 * World.骰子大小奖励倍数);
											value4.保存人物的数据();
											value4.保存积分数据();
											value4.系统提示("买" + text4 + "赔大,赔您：" + ((double)value4.积分赌注 * World.骰子大小奖励倍数).ToString() + "个积分！", 10, World.骰子提示设置);
										}
										else if (text4 != "豹子" && value4.购买大小 == num20.ToString())
										{
											value4.FLD_RXPIONTX += (int)((double)value4.积分赌注 * World.骰子大小奖励倍数);
											value4.保存人物的数据();
											value4.保存积分数据();
											value4.系统提示("哎哟。买中 " + num20.ToString() + " 点，赔您：" + ((double)value4.积分赌注 * World.骰子点数奖励倍数).ToString() + "个积分！", 10, World.骰子提示设置);
										}
										else if (text4 == "豹子" && value4.购买大小 == "豹子")
										{
											value4.FLD_RXPIONTX += (int)((double)value4.积分赌注 * World.骰子豹子奖励倍数);
											value4.保存人物的数据();
											value4.保存积分数据();
											value4.系统提示("哇，3个" + num17.ToString() + "豹子耶，这也让你买中了，赔你" + ((double)value4.积分赌注 * World.骰子豹子奖励倍数).ToString() + "个积分！", 10, World.骰子提示设置);
										}
										else
										{
											value4.保存人物的数据();
											value4.保存元宝数据();
											value4.系统提示("杀了您：" + value4.积分赌注.ToString() + "个积分！", 10, World.骰子提示设置);
										}
									}
									value4.积分赌注 = 0;
									value4.购买大小 = "0";
									value4.大小次数 = 0;
									value4.保存人物数据存储过程();
								}
							}
						}
						else
						{
							int num21 = random2.Next(2, 7);
							int num22 = random2.Next(2, 7);
							int num23 = random2.Next(3, 7);
							int num24 = num21 + num22 + num23;
							string text5 = (Convert.ToInt32(num21) == Convert.ToInt32(num22) && Convert.ToInt32(num21) == Convert.ToInt32(num23)) ? "豹子" : ((num24 < 10 || (Convert.ToInt32(num21) == Convert.ToInt32(num22) && Convert.ToInt32(num21) == Convert.ToInt32(num23))) ? "小" : "大");
							foreach (Players value5 in World.allConnectedChars.Values)
							{
								if (value5.积分赌注 != 0)
								{
									value5.系统提示("第一个骰子开出：" + num21.ToString(), 20, World.骰子提示设置);
									value5.系统提示("第二个骰子开出：" + num22.ToString(), 20, World.骰子提示设置);
									value5.系统提示("第三个骰子开出：" + num23.ToString(), 20, World.骰子提示设置);
									if (text5 != "豹子")
									{
										value5.系统提示(num21.ToString() + "." + num22.ToString() + "." + num23.ToString() + " ，" + (num21 + num22 + num23).ToString() + "点。" + text5, 22, World.骰子提示设置);
									}
									else
									{
										value5.系统提示(num21.ToString() + "." + num22.ToString() + "." + num23.ToString() + " ，" + num21.ToString() + text5, 22, World.骰子提示设置);
									}
									if (World.骰子功能是否开启 == 1)
									{
										if (text5 != "豹子" && value5.购买大小 == text5)
										{
											value5.FLD_RXPIONTX += (int)((double)value5.积分赌注 * World.骰子大小奖励倍数);
											value5.保存人物的数据();
											value5.保存积分数据();
											value5.系统提示("买" + text5 + "赔大,赔您：" + ((double)value5.积分赌注 * World.骰子大小奖励倍数).ToString() + "个积分！", 10, World.骰子提示设置);
										}
										else if (text5 != "豹子" && value5.购买大小 == num24.ToString())
										{
											value5.FLD_RXPIONTX += (int)((double)value5.积分赌注 * World.骰子大小奖励倍数);
											value5.保存人物的数据();
											value5.保存积分数据();
											value5.系统提示("哎哟。买中 " + num24.ToString() + " 点，赔您：" + ((double)value5.积分赌注 * World.骰子点数奖励倍数).ToString() + "个积分！", 10, World.骰子提示设置);
										}
										else if (text5 == "豹子" && value5.购买大小 == "豹子")
										{
											value5.FLD_RXPIONTX += (int)((double)value5.积分赌注 * World.骰子豹子奖励倍数);
											value5.保存人物的数据();
											value5.保存积分数据();
											value5.系统提示("哇，3个" + num21.ToString() + "豹子耶，这也让你买中了，赔你" + ((double)value5.积分赌注 * World.骰子豹子奖励倍数).ToString() + "个积分！", 10, World.骰子提示设置);
										}
										else
										{
											value5.保存人物的数据();
											value5.保存元宝数据();
											value5.系统提示("杀了您：" + value5.积分赌注.ToString() + "个积分！", 10, World.骰子提示设置);
										}
									}
									value5.积分赌注 = 0;
									value5.购买大小 = "0";
									value5.大小次数 = 0;
									value5.保存人物数据存储过程();
								}
							}
						}
					}
					else
					{
						int num25 = random2.Next(1, 7);
						int num26 = random2.Next(1, 7);
						int num27 = random2.Next(1, 7);
						int num28 = num25 + num26 + num27;
						string text6 = (Convert.ToInt32(num25) == Convert.ToInt32(num26) && Convert.ToInt32(num25) == Convert.ToInt32(num27)) ? "豹子" : ((num28 < 10 || (Convert.ToInt32(num25) == Convert.ToInt32(num26) && Convert.ToInt32(num25) == Convert.ToInt32(num27))) ? "小" : "大");
						foreach (Players value6 in World.allConnectedChars.Values)
						{
							if (value6.积分赌注 != 0)
							{
								value6.系统提示("第一个骰子开出：" + num25.ToString(), 20, World.骰子提示设置);
								value6.系统提示("第二个骰子开出：" + num26.ToString(), 20, World.骰子提示设置);
								value6.系统提示("第三个骰子开出：" + num27.ToString(), 20, World.骰子提示设置);
								if (text6 != "豹子")
								{
									value6.系统提示(num25.ToString() + "." + num26.ToString() + "." + num27.ToString() + " ，" + (num25 + num26 + num27).ToString() + "点。" + text6, 22, World.骰子提示设置);
								}
								else
								{
									value6.系统提示(num25.ToString() + "." + num26.ToString() + "." + num27.ToString() + " ，" + num25.ToString() + text6, 22, World.骰子提示设置);
								}
								if (World.骰子功能是否开启 == 1)
								{
									if (text6 != "豹子" && value6.购买大小 == text6)
									{
										value6.FLD_RXPIONTX += (int)((double)value6.积分赌注 * World.骰子大小奖励倍数);
										value6.保存人物的数据();
										value6.保存积分数据();
										value6.系统提示("买" + text6 + "赔大,赔您：" + ((double)value6.积分赌注 * World.骰子大小奖励倍数).ToString() + "个积分！", 10, World.骰子提示设置);
									}
									else if (text6 != "豹子" && value6.购买大小 == num28.ToString())
									{
										value6.FLD_RXPIONTX += (int)((double)value6.积分赌注 * World.骰子大小奖励倍数);
										value6.保存人物的数据();
										value6.保存积分数据();
										value6.系统提示("哎哟。买中 " + num28.ToString() + " 点，赔您：" + ((double)value6.积分赌注 * World.骰子点数奖励倍数).ToString() + "个积分！", 10, World.骰子提示设置);
									}
									else if (text6 == "豹子" && value6.购买大小 == "豹子")
									{
										value6.FLD_RXPIONTX += (int)((double)value6.积分赌注 * World.骰子豹子奖励倍数);
										value6.保存人物的数据();
										value6.保存积分数据();
										value6.系统提示("哇，3个" + num25.ToString() + "豹子耶，这也让你买中了，赔你" + ((double)value6.积分赌注 * World.骰子豹子奖励倍数).ToString() + "个积分！", 10, World.骰子提示设置);
									}
									else
									{
										value6.保存人物的数据();
										value6.保存元宝数据();
										value6.系统提示("杀了您：" + value6.积分赌注.ToString() + "个积分！", 10, World.骰子提示设置);
									}
								}
								value6.积分赌注 = 0;
								value6.购买大小 = "0";
								value6.大小次数 = 0;
								value6.保存人物数据存储过程();
							}
						}
					}
					DBA.ExeSqlCommand("update TBL_人物数据 set 购买大小='0',积分赌注=0,大小次数=0 where (ID>=0)", "GameServer");
					World.骰子.Dispose();
				}
				catch (Exception)
				{
				}
			}
			if (World.是否开启赌博类型 == 2)
			{
				try
				{
					World.骰子提示设置.Split(';');
					Random random3 = new Random();
					int num29 = 0;
					int num30 = 0;
					DataTable dBToDataTable3 = DBA.GetDBToDataTable("SELECT 购买大小,sum(武勋赌注) AS 武勋赌注 From TBL_人物数据 group by 购买大小", "GameServer");
					for (int k = 0; k < dBToDataTable3.Rows.Count; k++)
					{
						if (dBToDataTable3.Rows[k]["购买大小"].ToString().Equals("大"))
						{
							num29 = int.Parse(dBToDataTable3.Rows[k]["武勋赌注"].ToString());
						}
						else if (dBToDataTable3.Rows[k]["购买大小"].ToString().Equals("小"))
						{
							num30 = int.Parse(dBToDataTable3.Rows[k]["武勋赌注"].ToString());
						}
					}
					if (num29 + num30 >= World.作假下注额)
					{
						if (num29 > num30)
						{
							int num31 = random3.Next(1, 3);
							int num32 = random3.Next(1, 4);
							int num33 = random3.Next(1, 5);
							int num34 = num31 + num32 + num33;
							string text7 = (Convert.ToInt32(num31) == Convert.ToInt32(num32) && Convert.ToInt32(num31) == Convert.ToInt32(num33)) ? "豹子" : ((num34 < 10 || (Convert.ToInt32(num31) == Convert.ToInt32(num32) && Convert.ToInt32(num31) == Convert.ToInt32(num33))) ? "小" : "大");
							foreach (Players value7 in World.allConnectedChars.Values)
							{
								if (value7.武勋赌注 != 0)
								{
									value7.系统提示("第一个骰子开出：" + num31.ToString(), 20, World.骰子提示设置);
									value7.系统提示("第二个骰子开出：" + num32.ToString(), 20, World.骰子提示设置);
									value7.系统提示("第三个骰子开出：" + num33.ToString(), 20, World.骰子提示设置);
									if (text7 != "豹子")
									{
										value7.系统提示(num31.ToString() + "." + num32.ToString() + "." + num33.ToString() + " ，" + (num31 + num32 + num33).ToString() + "点。" + text7, 22, World.骰子提示设置);
									}
									else
									{
										value7.系统提示(num31.ToString() + "." + num32.ToString() + "." + num33.ToString() + " ，" + num31.ToString() + text7, 22, World.骰子提示设置);
									}
									if (World.骰子功能是否开启 == 1)
									{
										if (text7 != "豹子" && value7.购买大小 == text7)
										{
											value7.Player_WuXun += (int)((double)value7.武勋赌注 * World.骰子大小奖励倍数);
											value7.保存人物的数据();
											value7.更新武勋效果();
											value7.系统提示("买" + text7 + "赔大,赔您：" + ((double)value7.武勋赌注 * World.骰子大小奖励倍数).ToString() + "个武勋！", 10, World.骰子提示设置);
										}
										else if (text7 != "豹子" && value7.购买大小 == num34.ToString())
										{
											value7.Player_WuXun += (int)((double)value7.武勋赌注 * World.骰子大小奖励倍数);
											value7.保存人物的数据();
											value7.更新武勋效果();
											value7.系统提示("哎哟。买中 " + num34.ToString() + " 点，赔您：" + ((double)value7.武勋赌注 * World.骰子点数奖励倍数).ToString() + "个武勋！", 10, World.骰子提示设置);
										}
										else if (text7 == "豹子" && value7.购买大小 == "豹子")
										{
											value7.Player_WuXun += (int)((double)value7.武勋赌注 * World.骰子豹子奖励倍数);
											value7.保存人物的数据();
											value7.更新武勋效果();
											value7.系统提示("哇，3个" + num31.ToString() + "豹子耶，这也让你买中了，赔你" + ((double)value7.武勋赌注 * World.骰子豹子奖励倍数).ToString() + "个武勋！", 10, World.骰子提示设置);
										}
										else
										{
											value7.保存人物的数据();
											value7.更新武勋效果();
											value7.系统提示("杀了您：" + value7.武勋赌注.ToString() + "个武勋！", 10, World.骰子提示设置);
										}
									}
									value7.武勋赌注 = 0;
									value7.购买大小 = "0";
									value7.大小次数 = 0;
									value7.保存人物数据存储过程();
								}
							}
						}
						else
						{
							int num35 = random3.Next(2, 7);
							int num36 = random3.Next(2, 7);
							int num37 = random3.Next(3, 7);
							int num38 = num35 + num36 + num37;
							string text8 = (Convert.ToInt32(num35) == Convert.ToInt32(num36) && Convert.ToInt32(num35) == Convert.ToInt32(num37)) ? "豹子" : ((num38 < 10 || (Convert.ToInt32(num35) == Convert.ToInt32(num36) && Convert.ToInt32(num35) == Convert.ToInt32(num37))) ? "小" : "大");
							foreach (Players value8 in World.allConnectedChars.Values)
							{
								if (value8.武勋赌注 != 0)
								{
									value8.系统提示("第一个骰子开出：" + num35.ToString(), 20, World.骰子提示设置);
									value8.系统提示("第二个骰子开出：" + num36.ToString(), 20, World.骰子提示设置);
									value8.系统提示("第三个骰子开出：" + num37.ToString(), 20, World.骰子提示设置);
									if (text8 != "豹子")
									{
										value8.系统提示(num35.ToString() + "." + num36.ToString() + "." + num37.ToString() + " ，" + (num35 + num36 + num37).ToString() + "点。" + text8, 22, World.骰子提示设置);
									}
									else
									{
										value8.系统提示(num35.ToString() + "." + num36.ToString() + "." + num37.ToString() + " ，" + num35.ToString() + text8, 22, World.骰子提示设置);
									}
									if (World.骰子功能是否开启 == 1)
									{
										if (text8 != "豹子" && value8.购买大小 == text8)
										{
											value8.Player_WuXun += (int)((double)value8.武勋赌注 * World.骰子大小奖励倍数);
											value8.保存人物的数据();
											value8.更新武勋效果();
											value8.系统提示("买" + text8 + "赔大,赔您：" + ((double)value8.武勋赌注 * World.骰子大小奖励倍数).ToString() + "个武勋！", 10, World.骰子提示设置);
										}
										else if (text8 != "豹子" && value8.购买大小 == num38.ToString())
										{
											value8.Player_WuXun += (int)((double)value8.武勋赌注 * World.骰子大小奖励倍数);
											value8.保存人物的数据();
											value8.更新武勋效果();
											value8.系统提示("哎哟。买中 " + num38.ToString() + " 点，赔您：" + ((double)value8.武勋赌注 * World.骰子点数奖励倍数).ToString() + "个武勋！", 10, World.骰子提示设置);
										}
										else if (text8 == "豹子" && value8.购买大小 == "豹子")
										{
											value8.Player_WuXun += (int)((double)value8.武勋赌注 * World.骰子豹子奖励倍数);
											value8.保存人物的数据();
											value8.更新武勋效果();
											value8.系统提示("哇，3个" + num35.ToString() + "豹子耶，这也让你买中了，赔你" + ((double)value8.武勋赌注 * World.骰子豹子奖励倍数).ToString() + "个武勋！", 10, World.骰子提示设置);
										}
										else
										{
											value8.保存人物的数据();
											value8.更新武勋效果();
											value8.系统提示("杀了您：" + value8.武勋赌注.ToString() + "个武勋！", 10, World.骰子提示设置);
										}
									}
									value8.武勋赌注 = 0;
									value8.购买大小 = "0";
									value8.大小次数 = 0;
									value8.保存人物数据存储过程();
								}
							}
						}
					}
					else
					{
						int num39 = random3.Next(1, 7);
						int num40 = random3.Next(1, 7);
						int num41 = random3.Next(1, 7);
						int num42 = num39 + num40 + num41;
						string text9 = (Convert.ToInt32(num39) == Convert.ToInt32(num40) && Convert.ToInt32(num39) == Convert.ToInt32(num41)) ? "豹子" : ((num42 < 10 || (Convert.ToInt32(num39) == Convert.ToInt32(num40) && Convert.ToInt32(num39) == Convert.ToInt32(num41))) ? "小" : "大");
						foreach (Players value9 in World.allConnectedChars.Values)
						{
							if (value9.武勋赌注 != 0)
							{
								value9.系统提示("第一个骰子开出：" + num39.ToString(), 20, World.骰子提示设置);
								value9.系统提示("第二个骰子开出：" + num40.ToString(), 20, World.骰子提示设置);
								value9.系统提示("第三个骰子开出：" + num41.ToString(), 20, World.骰子提示设置);
								if (text9 != "豹子")
								{
									value9.系统提示(num39.ToString() + "." + num40.ToString() + "." + num41.ToString() + " ，" + (num39 + num40 + num41).ToString() + "点。" + text9, 22, World.骰子提示设置);
								}
								else
								{
									value9.系统提示(num39.ToString() + "." + num40.ToString() + "." + num41.ToString() + " ，" + num39.ToString() + text9, 22, World.骰子提示设置);
								}
								if (World.骰子功能是否开启 == 1)
								{
									if (text9 != "豹子" && value9.购买大小 == text9)
									{
										value9.Player_WuXun += (int)((double)value9.武勋赌注 * World.骰子大小奖励倍数);
										value9.保存人物的数据();
										value9.更新武勋效果();
										value9.系统提示("买" + text9 + "赔大,赔您：" + ((double)value9.武勋赌注 * World.骰子大小奖励倍数).ToString() + "个武勋！", 10, World.骰子提示设置);
									}
									else if (text9 != "豹子" && value9.购买大小 == num42.ToString())
									{
										value9.Player_WuXun += (int)((double)value9.武勋赌注 * World.骰子大小奖励倍数);
										value9.保存人物的数据();
										value9.更新武勋效果();
										value9.系统提示("哎哟。买中 " + num42.ToString() + " 点，赔您：" + ((double)value9.武勋赌注 * World.骰子点数奖励倍数).ToString() + "个武勋！", 10, World.骰子提示设置);
									}
									else if (text9 == "豹子" && value9.购买大小 == "豹子")
									{
										value9.Player_WuXun += (int)((double)value9.武勋赌注 * World.骰子豹子奖励倍数);
										value9.保存人物的数据();
										value9.更新武勋效果();
										value9.系统提示("哇，3个" + num39.ToString() + "豹子耶，这也让你买中了，赔你" + ((double)value9.武勋赌注 * World.骰子豹子奖励倍数).ToString() + "个武勋！", 10, World.骰子提示设置);
									}
									else
									{
										value9.保存人物的数据();
										value9.更新武勋效果();
										value9.系统提示("杀了您：" + value9.武勋赌注.ToString() + "个武勋！", 10, World.骰子提示设置);
									}
								}
								value9.武勋赌注 = 0;
								value9.购买大小 = "0";
								value9.大小次数 = 0;
								value9.保存人物数据存储过程();
							}
						}
					}
					DBA.ExeSqlCommand("update TBL_人物数据 set 购买大小='0',武勋赌注=0,大小次数=0 where (ID>=0)", "GameServer");
					World.骰子.Dispose();
				}
				catch (Exception)
				{
				}
			}
		}

		public void 骰子开始(object sender, ElapsedEventArgs e)
		{
			timer_0.Enabled = false;
			timer_0.Close();
			timer_0.Dispose();
			timer_1.Enabled = false;
			timer_1.Close();
			timer_1.Dispose();
			timer_2 = new System.Timers.Timer((double)int.Parse(string_0[3]) * 1000.0);
			timer_2.Elapsed += 骰子结束;
			timer_2.Enabled = true;
			new Random(DateTime.Now.Millisecond);
			int.Parse(string_0[2]);
			int.Parse(string_0[3]);
			new List<MonSterClss>();
			if (World.是否开启赌博类型 == 0)
			{
				try
				{
					foreach (Players value in World.allConnectedChars.Values)
					{
						if (value.大小赌注 != 0)
						{
							value.系统提示("开咯开咯！ " + int.Parse(string_0[3]).ToString() + " 秒后，看看您买中了吗？", 10, World.骰子提示设置);
						}
					}
				}
				catch (Exception ex)
				{
					Form1.WriteLine(1, "骰子 时间结束事件1 出错：" + ex?.ToString());
				}
			}
			if (World.是否开启赌博类型 == 1)
			{
				try
				{
					foreach (Players value2 in World.allConnectedChars.Values)
					{
						if (value2.积分赌注 != 0)
						{
							value2.系统提示("开咯开咯！ " + int.Parse(string_0[3]).ToString() + " 秒后，看看您买中了吗？", 10, World.骰子提示设置);
						}
					}
				}
				catch (Exception ex2)
				{
					Form1.WriteLine(1, "骰子 时间结束事件1 出错：" + ex2?.ToString());
				}
			}
			if (World.是否开启赌博类型 == 2)
			{
				try
				{
					foreach (Players value3 in World.allConnectedChars.Values)
					{
						if (value3.武勋赌注 != 0)
						{
							value3.系统提示("开咯开咯！ " + int.Parse(string_0[3]).ToString() + " 秒后，看看您买中了吗？", 10, World.骰子提示设置);
						}
					}
				}
				catch (Exception ex3)
				{
					Form1.WriteLine(1, "骰子 时间结束事件1 出错：" + ex3?.ToString());
				}
			}
		}
	}
}
